package com.onlyforfun.exchange.util;

import android.content.Context;

import com.onlyforfun.exchange.R;

public class CurrencyConverter {
	public static String getIdByName(Context context, String name, int bank) {
		String[] currencyName = context.getResources().getStringArray(R.array.CurrencyName);
		String[] currencyId;
		if (bank == 0) {
			 currencyId = context.getResources().getStringArray(R.array.CurrencyIdBoc);
		} else {
			 currencyId = context.getResources().getStringArray(R.array.CurrencyIdIcbc);
		}
        for(int i = 0; i < currencyName.length; i++) {
        	if (name.equals(currencyName[i])) {
        		return currencyId[i];
        	}
        }
        return "";
	}
	
	public static int getIconByName(String name) {
		if ("英镑".equals(name)) {
			return R.drawable.united_kingdom;
		} else if ("港币".equals(name)) {
			return R.drawable.hong_kong;
		} else if ("美元".equals(name)) {
			return R.drawable.united_states;
		} else if ("瑞士法郎".equals(name)) {
			return R.drawable.switzerland;
		} else if ("德国马克".equals(name)) {
			return R.drawable.germany;
		} else if ("法国法郎".equals(name)) {
			return R.drawable.france;
		} else if ("新加坡元".equals(name)) {
			return R.drawable.singapore;
		} else if ("瑞典克朗".equals(name)) {
			return R.drawable.sweden;
		} else if ("丹麦克朗".equals(name)) {
			return R.drawable.denmark;
		} else if ("挪威克朗".equals(name)) {
			return R.drawable.norway;
		} else if ("日元".equals(name)) {
			return R.drawable.japan;
		} else if ("加拿大元".equals(name)) {
			return R.drawable.canada;
		} else if ("澳大利亚元".equals(name)) {
			return R.drawable.australia;
		} else if ("欧元".equals(name)) {
			return R.drawable.european;
		} else if ("澳门元".equals(name)) {
			return R.drawable.macau;
		} else if ("菲律宾比索".equals(name)) {
			return R.drawable.philippines;
		} else if ("泰国铢".equals(name)) {
			return R.drawable.thailand;
		} else if ("新西兰元".equals(name)) {
			return R.drawable.new_zealand;
		} else if ("韩国元".equals(name)) {
			return R.drawable.korea;
		} else if ("卢布".equals(name)) {
			return R.drawable.russia;
		} else if ("西班牙比塞塔".equals(name)) {
			return R.drawable.spain;
		} else if ("意大利里拉".equals(name)) {
			return R.drawable.italy;
		} else if ("荷兰盾".equals(name)) {
			return R.drawable.netherlands;
		} else if ("比利时法郎".equals(name)) {
			return R.drawable.belgium;
		} else if ("芬兰马克".equals(name)) {
			return R.drawable.finland;
		} else {
			return R.drawable.china;
		}
	}
}
